open Common
open Io

exception Control_connect_closed

let perror_for_reply_code reply_code =
  match reply_code with
  | 421 ->
      print_error_msg ("Service not available.\n");
      raise Control_connect_closed
  | 425 ->
      print_error_msg ("Can't open data connection.\n")
  | 426 ->
      print_error_msg ("Connection closed; transfer aborted.\n")
  | 451 ->
      print_error_msg ("Requested action aborted: local error in processing.\n")
  | 500 ->
      print_error_msg ("Syntax error; command unrecognized.\n")
  | 501 ->
      print_error_msg ("Syntax error in arguments.\n")
  | 530 ->
      print_error_msg ("Not logged in.\n")
  | 551 ->
      print_error_msg ("Requested action aborted: page type unknown.\n")
  | 552 ->
      print_error_msg ("Requested file action aborted: exceeded storage allocation.\n")
  | _ ->
      print_error_msg ("Command failed for unknown errors.\n")
